package com.ews.onlineexchange.controller;

import javax.enterprise.inject.Model;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.inject.Inject;

import com.ews.onlineexchange.dao.ServiceBuyerDao;
import com.ews.onlineexchange.model.ServiceBuyer;
import com.ews.onlineexchange.model.User;
import com.ews.onlineexchange.service.UserService;

@Model
public class LoginedServiceBuyerController {
	
	@Inject
	ServiceBuyerDao serviceBuyerDao;
		
	@Inject
	UserService userService;
	
	private ServiceBuyer serviceBuyer;
	
	public void init() {
		User loginedUser = userService.getLoginedUser();
		
		serviceBuyer = serviceBuyerDao.find(loginedUser.getId());		
		
		ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
	}

	public ServiceBuyer getServiceBuyer() {
		return serviceBuyer;
	}

	public void setServiceBuyer(ServiceBuyer serviceBuyer) {
		this.serviceBuyer = serviceBuyer;
	}
	
}
